package es.battleship.model;

import java.util.List;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

import com.google.appengine.api.datastore.Key;



/**
 * The player has got a name of identification, a board where to place the ships
 * and the list of shots he/she has already done.
 * 
 * @author mhuertas
 *
 */
@XmlRootElement
@PersistenceCapable
public class Board {
	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key id;
	
	
	@Persistent
	private List<Ship> ships;

	@Persistent
	private List<Shot> shots;


	public Board() {
	}
	
	public Key getId() {
		return id;
	}

	public void setId(Key id) {
		this.id = id;
	}
	
	@XmlTransient
	public List<Ship> getShips() {
		return ships;
	}

	public void setShips(List<Ship> ships) {
		this.ships = ships;
	}

	@XmlTransient
	public List<Shot> getShots() {
		return shots;
	}

	public void setShots(List<Shot> shots) {
		this.shots = shots;
	}

	public String toString() {
		return "Player { Id: " 
				+ id 
				+ " }";
	}

}

